package com.aaa.dao;

import com.aaa.pojo.Credit;
import com.aaa.pojo.UserInfo;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface UserInfoDao {
    UserInfo queryByName(String username);
    Boolean reg_insert(@Param("username")String username,@Param("password")String password);
    UserInfo queryById(Integer uid);
    Map<String,Object> queryUserDetails(Integer uid);
    Boolean updateUserDetails(JSONObject jsonObject);
    Boolean insertUserDetails(JSONObject jsonObject);
    Boolean updateVisits(@Param("auths")String auths,@Param("uid")Integer uid);
    List<UserInfo> queryUserAll();
    //根据用户名修改密码
    @Update("update sys_user set password=#{password} where uid=#{uid}")
    Boolean updatePwdByUid(Integer uid,String password);
    //根据用户id查询密码
    @Select("select password from sys_user where uid=#{uid}")
    String selPwdByUid(Integer uid);

    List<Credit> selectAllCredict();
    Credit selectCreditById(@Param("uid")Integer uid);
    List<Credit> AllCredit();
    Boolean updateUserCredit(@Param("uid") Integer uid,@Param("cd_id") Integer cd_id);
}
